#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define OJ_TEST 0
#define LOCAL_TEST 0

#define M 901

static int max(int a, int b){ return a>b?a:b; }
static int min(int a, int b) { return a<b?a:b; }

static void solve(void){
	static int stack[M];
	int i, n, ans, avg, cs;
	cs=0;
	while(scanf("%d", &n)){
		if(!n) break;
		for(avg=0,i=0; i<n; ++i){
			scanf("%d", stack+i);
			avg += stack[i];
		}
		avg /=n;
		for(ans=0, i=0; i<n; ++i){
			if(stack[i]>avg){
				ans += stack[i]-avg;
			}
		}
		printf("Set #%d\n", ++cs);
		printf("The minimum number of moves is %d.\n\n", ans);
	}
}
#if OJ_TEST
	int main(int ac, char *av[]){
		solve();
		return 0;
	}
#elif  LOCAL_TEST
	void run(void){
		solve();
	}

#else

#endif
